// 自动禁用非开放岗位的申请按钮
document.querySelectorAll('.btn-apply').forEach(btn => {
    const status = btn.closest('tr').dataset.status;
    btn.disabled = status !== 'open';
    btn.textContent = status === 'open' ? '立即申请' : '暂不可申请';
});
// 移动端状态标签布局调整
function adjustMobileLayout() {
    if(window.innerWidth < 768) {
        document.querySelectorAll('[data-label="岗位状态"]').forEach(td => {
            td.style.flexDirection = 'column';
            td.querySelector('.status-tag').style.marginTop = '0.5rem';
        });
    }
}
// 添加多条件筛选
const filters = {
    status: 'all',
    location: '',
    salaryRange: ''
};
function applyFilters() {
    document.querySelectorAll('tr').forEach(row => {
        const matchStatus = filters.status === 'all' || row.dataset.status === filters.status;
        const matchLocation = !filters.location || row.dataset.location === filters.location;
        const visible = matchStatus && matchLocation;
        row.style.display = visible ? '' : 'none';
    });
}
// 实时状态统计
function updateStatusStats() {
    const stats = {
        open: document.querySelectorAll('[data-status="open"]:not([style*="display: none"])').length,
        total: document.querySelectorAll('tr:not([style*="display: none"])').length
    };
    
    document.getElementById('statsPanel').innerHTML = `
        当前显示：${stats.total}个岗位 
        (招聘中：${stats.open}个)
        `;}
        // 保存筛选状态
function saveFilterState() {
    localStorage.setItem('jobFilter', JSON.stringify({
        status: statusFilter.value,
        search: searchInput.value
    }));
}
// 初始化时加载
const savedFilter = JSON.parse(localStorage.getItem('jobFilter')) || {};
statusFilter.value = savedFilter.status || 'all';
searchInput.value = savedFilter.search || '';
